package com.xiaotu.decorator;

/**
 * @author 张晓
 * @create 2020-06-20 20:13
 */
public class Decorator extends Drink {

    private Drink obj;

    public Decorator(Drink obj) {//组合
        this.obj = obj;
    }

    @Override
    public float cost() {
        //getPrice 自己的价格
        return super.getPrice() + obj.cost();
    }

    @Override
    public String getDes() {
        //obj.getDes() 输出了被装饰者的信息
        return super.des+" "+super.getPrice()+" && "+obj.getDes();
    }
}
